
<html>
<head>
<meta charset="UTF-8">
<title>字典选项信息修改</title>
<link href="../../static/easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css"/>
<link href="../../static/easyui/themes/icon.css" rel="stylesheet" type="text/css"/>
<link href="../../static/css/esaas-easyui-edit.css" rel="stylesheet" type="text/css"/>
<script src="../../static/easyui/jquery.min.js" type="text/javascript"></script>
<script src="../../static/easyui/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../static/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.util.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.jquery.ajax.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.easyui.util.js" type="text/javascript"></script>
<script src="../../ffres/dict/all.js"></script>
<a href="" target="_blank" id="commonLink" name="commonLink"></a>
</head>
<body class="easyui-layout" scroll="no">
	<div data-options="region:'north',split:false" style="height:245px">
		<form id="ff" method="post">
			<div class="esaas-info-title">数据选项信息</div>
			<table class="esaas-info-edit-table">
				<tr>
					<td width="15%" align="right">选项代码：</td>
					<td width="35%"><input class="easyui-textbox" type="text"
						name="dictCode" id="dictCode" data-options="required:true"
						style="width: 100%; height: 25px;"></input></td>
					<td width="15%" align="right">选项名称：</td>
					<td width="35%"><input class="easyui-textbox" type="text"
						name="dictName" id="dictName" data-options="required:true"
						style="width: 100%; height: 25px;"></input>
						<input type="hidden" name="dictId" id="dictId">
					</td>
				</tr>
				<tr>
					<td width="15%" align="right">选项类型：</td>
					<td width="35%"><select class="easyui-combobox" id="dictType"
						name="dictType" style="width: 100%; height: 25px;"
						data-options="required:true,editable:false,valueField:'enname',textField:'cnname',data:DM_DICT_TYPE"></select></td>
					<td width="15%" align="right">是否国际：</td>
					<td width="35%"><select class="easyui-combobox" id="dictIsStd"
						name="dictIsStd" style="width: 100%; height: 25px;"
						data-options="required:true,editable:false,valueField:'enname',textField:'cnname',data:STD_PUB_YN"></select>
					</td>
				</tr>
	    		<tr>
	    			<td width="15%" align="right">所属主题：</td>
	    			<td width="35%"><input class="easyui-textbox" type="text" name="subjectId" data-options="required:false" style="width:100%;height:25px;"></input></td>
	    			<td width="15%" align="right"></td>
	    			<td width="35%">
	    			</td>	    			
	    		</tr>				
				<tr>
					<td width="15%" align="right" valign="top">选项描述：</td>
					<td colspan="3"><textarea name="dictRemarks" id="dictRemarks"
							class="easyui-validatebox"
							style="overflow-x: hidden; height: 45px; width: 99%;"></textarea>
					</td>
				</tr>
			</table>
			<div style="text-align: center; padding: 8px">
				<a href="javascript:void(0)" class="easyui-linkbutton"
					onclick="submitForm()">&nbsp;保&nbsp;存&nbsp;</a> <a
					href="javascript:void(0)" class="easyui-linkbutton"
					onclick="closeForm()">&nbsp;关&nbsp;闭&nbsp;</a>
			</div>
		</form>
	</div>
	<div data-options="region:'center',split:false">
		<table id="dg" class="easyui-datagrid" title=""
			style="width: 100%; height: 100%"
			data-options="singleSelect:true,collapsible:true,url:'../../api/dict/option/enums?dictId=' + $.getUrlParam('dictId') ,method:'post'"
			toolbar="#tb" title="Load Data" rownumbers="true" pagination="true"
			pageSize="20">
			<thead>
				<tr>					
					<th data-options="field:'optionCode'" width="16%">选项值</th>
					<th data-options="field:'optionName'" width="20%">选项描述</th>
					<th data-options="field:'lastModifyUser'" width="10%">最近修改人</th>
					<th data-options="field:'lastModifyTime'" width="15%">最近修改时间</th>
					<th data-options="field:'optionRemarks'" width="35%">备注</th>
				</tr>
			</thead>
		</table>	
	</div>
	<div id="tb" style="padding:1px">
		<div style="margin-bottom:2px">
			<a href="javascript:doAddOptionEnum();" class="easyui-linkbutton" iconCls="icon-add" plain="true">创建选项值</a>		
			<a href="javascript:doUpdateOptionEnum();" class="easyui-linkbutton" iconCls="icon-edit" plain="true">修改选项值</a>
			<a href="javascript:doDeleteOptionEnum();" class="easyui-linkbutton" iconCls="icon-remove" plain="true">删除选项值</a>
			<a href="javascript:doViewOptionEnum();" class="easyui-linkbutton" iconCls="icon-ok" plain="true">查看选项值</a>
		</div>
	</div>

	<script>		
		$(function() {
			var dictId = $.getUrlParam('dictId');
			$.restfulGet('../../api/dict/option/info/' + dictId,null,function(data){
					$('#ff').form('load', {
						dictId : data.rows.dictId,
						dictCode : data.rows.dictCode,
						dictName : data.rows.dictName,
						dictType : data.rows.dictType,
						dictSrc : data.rows.dictSrc,
						dictIsStd : data.rows.dictIsStd,
						refCount : data.rows.refCount,
						subjectId : data.rows.subjectId,
						dictRemarks : data.rows.dictRemarks,
						createUser : data.rows.createUser,
						createTime : data.rows.createTime,
						lastModifyUser : data.rows.lastModifyUser,
						lastModifyTime : data.rows.lastModifyTime
					});					
			});
		});
	
		function submitForm() {
			if (!$('#ff').form('validate'))
				return;
			var jsonData = $("#ff").serializeJson();
			$.restfulPut('../../api/dict/option/info', jsonData, function(data) {
				window.parent.reloadList();
			});
		};
		
		function closeForm(){
			window.parent.JLEUtil.closewin();
		}
		
		function doAddOptionEnum() {
			JLEUtil
					.createModalWin('创建选项选项值',
							'DictOptionEnumAdd.html?dictId=' + $.getUrlParam('dictId'));
		}

		function doUpdateOptionEnum() {
			var row = $('#dg').datagrid('getSelected');
			if (row){
				JLEUtil.createModalWin('修改数据选项值', 'DictOptionEnumUpdate.html?' + 'optionId=' + row.optionId);
			} else {
				$.messager.alert('提示','请选择一条记录！','info');
			}
		}

		function doViewOptionEnum() {
			var row = $('#dg').datagrid('getSelected');
			if (row) {
				JLEUtil.createModalWin('详情','DictOptionEnumView.html?' + '&optionId=' + row.optionId);
			} else {
				$.messager.alert('提示','请选择一条记录！','info');
			}
		}

		function doDeleteOptionEnum() {
			var row = $('#dg').datagrid('getSelected');
			if (row) {
				$.messager.confirm('删除提示', '你确定要删除这条记录?', function(r){
					if (r){
						var jsonData = JSON.parse('{'+'"optionId":"' + row.optionId + '"'+'}');
						$.restfulDelete('../../api/dict/option/enum', jsonData, function(data) {
							$.messager.alert('提示','记录删除成功!','info');
							$('#dg').datagrid('reload');
						});
					}
				});
			} else {
				$.messager.alert('提示','请选择一条记录！','info');
			}
		}

		function reloadList() {
			$('#dg').datagrid('reload');
			JLEUtil.closewin();
		};
		
	</script>
</body>
</html>
